{{template "admin/public/head.html" .}}
<section>
	<aside>
		{{template "admin/public/nav.html" .}}
	</aside>
		<article>
			<div class="top-title">
				<dl>
					<dt><h1>{{.title}}</h1></dt>
					<dd><form method="get"><input type="text" class="input" placeholder="请输入您需要搜索的城市名字！" name="search"><input type="submit" value="搜索" class="button" /></form></dd>
				</dl>
			</div>
			<div class="content">
				<div class="release">
					<dl>
						<dt><i class="iconfont">&#xe649;</i> <b>{{.title}}设置说明</b><br>
							<p>在这里您可以自由设置热门城市。</p>
							<p>热门城市设置之后在地区选择时就可以看见。</p>
							<p>总部默认为热门城市</p>
						</dt>						
					</dl>
				</div>
				<table class="table">
					<!-- 控制表格宽度  横向合并 colspan="1"  竖向合并 rowspan="3" -->
					<thead><th width="5%">ID</th><th width="25%">城市列表</th><th width="15%">操作</th></thead>
					{{range .info}}
					<tr id={{.id}}>
						<td class="center">{{.id}}</td>
						<td>{{.name}}</td>
						<td class="operation"><a href="javascript: void(1)" class="hot" data-id={{.id}}>{{if eq .hot "1"}}取消热门城市{{else}}设置为热门城市{{end}}</a></td>
					</tr>
					{{end}}
					{{if ne .paginator.totalpages 1}}
					<tr>
						<td  colspan="5">
							<div class="paging">
								{{if ne .paginator.currpage 1}}
								<a href="{{$.url}}page={{.paginator.firstpage}}">首页</a>
								<a href="{{$.url}}page={{.paginator.prevpage}}">&lt;&lt;</a>
								{{else}}
								<a class="disable">首页</a>
								<a class="disable">&lt;&lt;</a>
								{{end}}
								{{range $index,$page := .paginator.pages}}
								{{if eq $.paginator.currpage $page}} 
								<a class="no">{{$page}}</a>
								{{else}}
								<a href="{{$.url}}page={{$page}}">{{$page}}</a>
								{{end}}
								{{end}}
								{{if eq .paginator.currpage .paginator.totalpages}}
								<a class="disable">&gt;&gt;</a>
								<a class="disable">尾页</a>
								{{else}}
								<a href="{{$.url}}page={{.paginator.nextpage}}">&gt;&gt;</a>
								<a href="{{$.url}}page={{.paginator.totalpages}}">尾页</a>
								{{end}}
							</div>
						</td>
					</tr>
					{{end}}
				</table>
			</div>
			<!-- 系统配置 -->
		</article>
	</section>

	<footer><!-- 系统监控内容 --></footer>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/jquery.jedate.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/toast.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/uppic.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/xcConfirm.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/app.js"></script>
	<script>
		$('.hot').click(function () {
			var that = $(this);
			var id = that.attr('data-id');
			$.ajax({
				url: '/admin/index/changeHotCity',
				data: {table: 'mt_shop', id: id},
				success: function (res) {
					if (res.status == 1) {
						showMessage('修改成功')
						that.text(that.text() === '设置为热门城市' ? '取消热门城市' : '设置为热门城市')
					} else {
						wxc.xcConfirm("操作失败,请重试","error");
					}
				}
			})
		})
	</script>
</body>
</html>
